package server.core.base;

import server.core.util.FormatDate;

public class Flight extends EntityBase{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7152678666682240240L;
	private FormatDate duration;
	private FormatDate departureTime;
	private FormatDate arrivalTime;
	private String airlineOperator;
	private boolean summerDST;
	
	private Airport from;
	public Airport getFrom() {
		return from;
	}
	public void setFrom(Airport from) {
		this.from = from;
	}
	
	private Airport to;
	public Airport getTo() {
		return to;
	}
	public void setTo(Airport to) {
		this.to = to;
	}
	
	private Airplane byAirplane;
	public Airplane getByAirplane() {
		return byAirplane;
	}
	public void setByAirplane(Airplane byAirplane) {
		this.byAirplane = byAirplane;
	}
	
	public Flight(Airport from, Airport to, FormatDate departureTime){
		this.setFrom(from);
		this.setTo(to);
//		this.setByAirplane(byAirplane);
		this.setDepartureTime(departureTime);
//		this.setArrivalTime(arrivalTime);
//		this.setDuration(duration);
//		this.setAirlineOperator(airlineOperator);
		
		from.getDepartureFlight().add(this);
		to.getArrivalFlight().add(this);
	}
	public String toString(){
		StringBuilder prt=new StringBuilder(1023);
		prt.append(
				 "id: "+getId()
				+", From: "+getFrom().getCity()
				+", To: "+getTo().getCity()
				+", Departure: "+getDepartureTime()
				+", Arrival: "+getArrivalTime()
				+", Duration: "+getDuration()
				+", Operator: "+getAirlineOperator());
		return prt.toString();
//				+", Airliner: "+getByAirplane().getName()
	}
	public FormatDate getDuration() {
		return duration;
	}
	public void setDuration(FormatDate duration) {
		this.duration = duration;
	}
	public FormatDate getDepartureTime() {
		return departureTime;
	}
	public void setDepartureTime(FormatDate departureTime) {
		this.departureTime = departureTime;
	}
	public FormatDate getArrivalTime() {
		return arrivalTime;
	}
	public void setArrivalTime(FormatDate arrivalTime) {
		this.arrivalTime = arrivalTime;
	}
	public String getAirlineOperator() {
		return airlineOperator;
	}
	public void setAirlineOperator(String airlineOperator) {
		this.airlineOperator = airlineOperator;
	}
	public boolean isSummerDST() {
		return summerDST;
	}
	public void setSummerDST(boolean summerDST) {
		this.summerDST = summerDST;
	}
	
	
}
